<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>酒店后台管理系统</title>
<jsp:include page="../commonCss.jsp" />
</head>
<body>
	<div class="layui-fluid">
		<div id="select">
			<div class="select_top">
				<div class="select_top_title">
					<span class="layui-breadcrumb" style="visibility:visible;padding: 12px 0 12px 20px;">
	                  <a href="" style="font-size:18px;">客户订单管理</a>
	                  <span lay-separator style="font-size:18px;">/</span>
	                  <a href="" style="font-size:18px;">订单管理</a>
	                  <span lay-separator style="font-size:18px;">/</span>
	                  <a href="" style="font-size:18px;"><cite>修改订单</cite></a>
	              	</span>
	              	<img style="float:right;margin-right:20px;" src="${pageContext.request.contextPath}/resources/img/icon_refresh.png" title="刷新当前页面"
              		width="25" height="25"/>
				</div>
			</div>
			<div class="select_nav1">
				<span>修改订单信息</span>
				<hr>
				<div style="height:520px;">
					<form action="" method="post">
						<label>订单编号</label>
						<input type="text" name="orderBH" id="orderBH" class="layui-disabled" disabled required="required"></input><br/>
						<label>所属酒店</label>
						<input type="text" name="nameJD" id="nameJD" class="layui-disabled" disabled required="required"></input><br/>
						<label>房间类别</label>
						<select id="category" name="category" required="required">
						    <option value="-1">选择类别</option>
							<option value="0">标准间</option>
							<option value="1">双人间</option>
							<option value="2">三人间</option>
						</select><br/>
						<label>支付价格</label>
						<input type="text" name="price" id="price" placeholder="请输入支付价格" required="required"></input><br/>
						<label>入住姓名</label>
						<input type="text" name="name" id="name" class="layui-disabled" disabled required="required"></input><br/>
						<label>入住电话</label>
						<input type="text" name="phone" id="phone" placeholder="请输入手机号码" required="required"></input><br/>
						<label>房间楼层</label>
						<input type="text" name="floor" id="floor" class="layui-disabled" disabled required="required"></input><br/>
						<label>&nbsp;&nbsp;&nbsp;房间号</label>
						<input type="text" name="roomNumber" id="roomNumber" class="layui-disabled" disabled required="required"></input><br/>
						<label>修改时间</label>
						<input type="text" name="updateTime" id="updateTime" class="layui-disabled" disabled required="required" ></input><br/>
						<input type="button" style="letter-spacing: 0px;" value="修改" class="btn"></input>
					</form>
				</div>
			</div>
		</div>
	</div>
</body>
<script src="https://layui.11dz.cn/layui-v2.6.8/layui/layui.js"></script>
<script src="${pageContext.request.contextPath}/resources/js/jquery-3.6.0.min.js"></script>
<script src="${pageContext.request.contextPath}/resources/js/jquery-cookie.js"></script>
<script type="text/javascript">
	layui.use('layer', function(){
		  var layer = layui.layer;
		  if(<%=request.getSession().getAttribute("username")%> !=null){
			  layer.msg("欢迎来到酒店后台管理系统");
	 }else{
		  alert("请登录");
		  window.open("${pageContext.request.contextPath}/views/admin/user/login.jsp");
	 }
	});
	function datetime() {
		 var now = new Date();
		 var s = now.getSeconds();
		 if(s <= 9){
			 s = "0" + now.getSeconds();
		 }
		 if(now.getMinutes() <= 9){
			 document.getElementById("updateTime").value = now.getFullYear() + "-"
			 + (now.getMonth() + 1) + "-" + now.getDate();
			 document.getElementById("updateTime").value += " " + now.getHours() + ":"
			 + "0" + now.getMinutes() + ":" + s;
		 }else{
			 document.getElementById("updateTime").value = now.getFullYear() + "-"
			 + (now.getMonth() + 1) + "-" + now.getDate();
			 document.getElementById("updateTime").value += " " + now.getHours() + ":"
			 + now.getMinutes() + ":" + s;
		 }
	}
	window.setInterval("datetime()", 1000);
	window.onload = function(){
		var orderBH = "<%=request.getParameter("orderBH")%>";
		var nameJD = "<%=request.getParameter("nameJD")%>";
		var name = "<%=request.getParameter("name")%>";
		var floor = "<%=request.getParameter("floor")%>";
		var roomNumber = "<%=request.getParameter("roomNumber")%>";
		document.getElementById("orderBH").value = orderBH;
		document.getElementById("nameJD").value = nameJD;
		document.getElementById("name").value = name;
		document.getElementById("floor").value = floor;
		document.getElementById("roomNumber").value = roomNumber;
	}
	$(document).ready(function(){
		$('.btn').on('click', function() {
			layui.use('layer', function(){
			  var layer = layui.layer;
			  layer.confirm('是否确定修改', function(){
				  $.ajax({
					url : "${pageContext.request.contextPath}/order/update",
					data : {
						'orderBH' : $('#orderBH').val(),
						'category' : $('#category').val(),
						'price' : $('#price').val(),
						'phone' : $('#phone').val(),
						'updateTime' : $('#updateTime').val()
					},
					type : "post",
					dataType : "json",
					success : function(data) {
						localStorage.setItem("isorderupdate", JSON.stringify(data));//这里是设置
						window.parent.layer.closeAll();
					},
					error : function(data) {
						layer.msg("修改失败");
						location.reload();
					}
				});
		      });
			});
		});
	});
	$(document).ready(function(){
		$('img').on('click', function() {
			location.reload();
		});
	});
</script>
</html>